package com.kkkkkba.search.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.gson.Gson;
import com.kkkkkba.search.common.BaseResponse;
import com.kkkkkba.search.common.ErrorCode;
import com.kkkkkba.search.common.ResultUtils;
import com.kkkkkba.search.exception.BusinessException;
import com.kkkkkba.search.exception.ThrowUtils;
import com.kkkkkba.search.model.dto.Picture.PictureQueryRequest;
import com.kkkkkba.search.model.entity.Picture;
import com.kkkkkba.search.model.entity.Post;
import com.kkkkkba.search.model.vo.MusicDetailsVo;
import com.kkkkkba.search.model.vo.PostVO;
import com.kkkkkba.search.service.MusicService;
import com.kkkkkba.search.service.PictureService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 音乐接口
 */
@RestController
@RequestMapping("/music")
@Slf4j
@Api(tags = "音乐接口")
public class MusicController {

    @Resource
    private MusicService musicService;

    /**
     * 根据 id 获取
     *
     * @param id
     * @return
     */
    @GetMapping("/get/vo")
    public BaseResponse<MusicDetailsVo> getPostVOById(long id, HttpServletRequest request) {
        if (id <= 0) {
            throw new BusinessException(ErrorCode.PARAMS_ERROR);
        }
//        Post post = musicService.getById(id);
//        if (post == null) {
//            throw new BusinessException(ErrorCode.NOT_FOUND_ERROR);
//        }
        return ResultUtils.success(musicService.getMusicVo(id, request));
    }
}
